<extend name="Layout/index" />
<block name="main">
	<div class="container">
	<div class="row">
	<div class="col-md-12" style="font-size:17px;">
			<p style="font-size:20px;">
				给角色 <b><{$rolelist.rolename}></b> 分配权限 <hr>
			</p>
			<form action="<{:U('Role/save_role_node',array('roleid'=>$rolelist['roleid']))}>" method='post'>
			<p style="width:800px;">
				<volist name="nodelist" id="vo"> 
					<input class="node" type="checkbox" name="<{$vo['node']}>" value="<{$vo['nodeid']}>" <if condition="in_array($vo['nodeid'],$role_node) eq true">checked</if>><{$vo['node']}>&nbsp;&nbsp;
					<if condition="$i%6 eq 0 "><br><hr></if>
				</volist>
			</p><hr>
			<button type="button" class="btn btn-info btn-xs" id="all">全选</button>&nbsp;&nbsp;
			<button type="button" class="btn btn-info btn-xs" id="none">全不选</button>&nbsp;&nbsp;
			<button type="button" class="btn btn-info btn-xs" id="else">反选</button><hr>
			<input type="submit" value="保 存" class="btn btn-primary">

			</form>
</div></div></div>
<script type="text/javascript">
	// 全选
	$('#all').click(function(){
		// each函数是一个回调函数,每次指向不同的DOM值
		$('.node').each(function(){
			$(this).attr('checked',true);
		})
		
	})
	// 全不选
	$('#none').click(function(){
		$('.node').each(function(){
			$(this).attr('checked',false);
		})
		
	})
	// 反选
	$('#else').click(function(){
		$('.node').each(function(){
			$(this).attr('checked',!$(this).attr('checked'));
		})
	})
	
</script>
</block>